﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ruction
{
    /// <summary>
    /// Interaction logic for WindowMain.xaml
    /// </summary>
    public partial class WindowMain : Window
    {
        public WindowMain()
        {
            InitializeComponent();
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == GameCommands.Exit) Environment.Exit(0);
            else if (e.Command == GameCommands.About) ShowAboutWindow();
            else if (e.Command == GameCommands.NetGameJoin) JoinNetworkGame();
            else if (e.Command == GameCommands.NetGameStart) StartNetworkGame();
            else if (e.Command == GameCommands.NetGameChatSend) NetworkGameSend();
        }

        private void ShowAboutWindow()
        {
            WindowAbout prompt = new WindowAbout() { Owner = this };
            prompt.ShowDialog();
        }

        private void NetworkGameSend()
        {
            // TODO: Implement sending in game chat.
            NotImplemented();
        }

        private void JoinNetworkGame()
        {
            WindowNetworkJoin prompt = new WindowNetworkJoin() { Owner = this };
            bool? result = prompt.ShowDialog();
            if (result.HasValue && result.Value)
            {
                // TODO: Join the network game as a client.
                NotImplemented();
            }
        }

        private void StartNetworkGame()
        {
            // TODO: Start a network game as the server.
            NotImplemented();
        }

        private void NotImplemented()
        {
            MessageBox.Show(this, "This functionality is not yet implemented.", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
        }
    }
}
